<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="../css/mui.min.css" rel="stylesheet" />
		<script src="../js/mui.min.js"></script>
		<script type="text/javascript" src="../js/other/common.js"></script>
		<script type="text/javascript">
			mui.init();

			var text = null;

			function startRecognize() {
				if(plus.os.name == 'Android' && navigator.userAgent.indexOf('StreamApp') > 0) {
					plus.nativeUI.toast('当前环境暂不支持语音识别插件');
					return;
				}
				var options = {};
				options.engine = 'iFly';
				//options.punctuation = false;	// 是否需要标点符号 
				text.value = "";
				outSet("开始语音识别：");
				plus.speech.startRecognize(options, function(s) {
					outLine(s);
					text.value += s;
				}, function(e) {
					outSet("语音识别失败：" + e.message);
				});
			}

			function startRecognizeEnglish() {
				if(plus.os.name == 'Android' && navigator.userAgent.indexOf('StreamApp') > 0) {
					plus.nativeUI.toast('当前环境暂不支持语音识别插件');
					return;
				}
				var options = {};
				options.engine = 'iFly';
				options.lang = 'en-us';
				text.value = "";
				outSet("开始语音识别：");
				plus.speech.startRecognize(options, function(s) {
					outLine(s);
					text.value += s;
				}, function(e) {
					outSet("语音识别失败：" + e.message);
				});
			}
		</script>
		<style type="text/css">
			.out {
				margin: 9px;
				height: 30%;
				width: 90%;
			}
		</style>
	</head>

	<body onload="text=document.getElementById('text');">

		<div id="dcontent" class="mui-content" style="padding: 18px;">
			<br/>
			<button class="mui-btn-blue" onclick="startRecognize()">开始语音识别</button>
			<br/>
			<button class="mui-btn-blue" style="margin-top: 10px;" onclick="startRecognizeEnglish()">开始语音识别（英语）</div>
			<br/>
			<textarea readonly="readonly" id="text" style="margin:2%;padding:2%;height:50%;width:90%;border:1px solid #6C6C6C;-webkit-border-radius: 2px;border-radius: 2px;-webkit-appearance:none;">语音输入内容
			</textarea>
		</div>
		<div id="output">
		</div>
	</body>

</html>